package static_test;

public class Main {

    public static void main(String[] args) {
        TicketSeller ticketSeller0 = new TicketSeller();
        TicketSeller ticketSeller1 = new TicketSeller();
        TicketSeller ticketSeller2 = new TicketSeller();
        TicketSeller ticketSeller3 = new TicketSeller();

        System.out.println("TicketSeller类被创建的次数为："+TicketSeller.num);

        while (true){
            if (TicketSeller.ticket==0){
                break;
            }
            ticketSeller0.sellTicket();
            System.out.println("ticketSeller0卖出一张票还剩"+TicketSeller.ticket);
            ticketSeller1.sellTicket();
            System.out.println("ticketSeller1卖出一张票还剩"+TicketSeller.ticket);
            ticketSeller2.sellTicket();
            System.out.println("ticketSeller2卖出一张票还剩"+TicketSeller.ticket);
            ticketSeller3.sellTicket();
            System.out.println("ticketSeller3卖出一张票还剩"+TicketSeller.ticket);
        }

    }
}
